package com.homegoods.resource.util;

import com.homegoods.classify.model.ClassifyBean;

import java.util.Comparator;

public class PinyinComparator implements Comparator<ClassifyBean> {
    @Override
    public int compare(ClassifyBean o1, ClassifyBean o2) {
        //这里主要是用来对ListView里面的数据根据ABCDEFG...来排序
        if (o2.getPinYin().substring(0, 1).equals("#")) {
            return -1;
        } else if (o1.getPinYin().substring(0, 1).equals("#")) {
            return 1;
        } else {
            return o1.getPinYin().substring(0, 1).compareTo(o2.getPinYin().substring(0, 1));
        }

    }

}
